<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/17 0017
 * Time: 下午 2:06
 */
namespace app\auth\validate;
class Vali_auth{
    const errmsg=[
        'id.require'                => 10011,#缺少参数
        'id.checkUserId'            => 10011,#缺少参数
        'auth_name.checkAuthName'   => 10026,#权限名称已存在
        'auth_name.checkAuthNameN'  => 10026,#权限名称已存在
        'auth_name.require'         => 10027,#权限名称不能为空
        'auth_id.require'           => 10011,#缺少参数
        'auth_id.checkAuthId'       => 10011,#缺少参数
        'auth_a.require'            => 10028,#方法名不能为空
        'auth_c.require'            => 10029,#控制器不能为空

    ];

    /**
     * 删除用户角色信息
     * @return array
     */
    public static function auth_del(){
        $rule = [
            'auth_id'        => 'require|checkAuthId',
        ];
        $message =self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }


    /**
     * 更改角色信息
     * @return array
     */
    public static function update(){
        $rule = [
            'auth_id'       => 'require|checkAuthId',
            'auth_name'     => 'require|checkAuthNameN',
        ];
        $message =self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }
    public static function update_ac(){
        $rule = [
            'auth_c'       => 'require',
            'auth_a'       => 'require',
        ];
        $message =self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }

    /**
     * 添加角色
     */
    public static function add(){
        $rule = [
            'auth_name'     => 'require|checkAuthName',
        ];
        $message =self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }
}